package com.hotelManagerSystem.service.impl;

import com.hotelManagerSystem.model.CleaningRecord;
import com.hotelManagerSystem.mapper.CleaningRecordMapper;
import com.hotelManagerSystem.service.ICleaningRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author treasy
 * @since 2021-12-22
 */
@Service
public class CleaningRecordServiceImpl extends ServiceImpl<CleaningRecordMapper, CleaningRecord> implements ICleaningRecordService {
    @Autowired
    CleaningRecordMapper cleaningRecordMapper;

    /**
     * @author treasy
     * @description 根据cleaningState查清理信息
     * @param cleaningState
     * @return
     */
    @Override
    public List<CleaningRecord> queryInfoByState(int cleaningState) {
        return cleaningRecordMapper.queryInfoByState(cleaningState);
    }

    /**
     * @author treasy
     * @description 根据cleaningRecordId更新信息
     * @param cleaningRecordId
     * @param staffId
     * @return
     */
    @Override
    public int updateRecordById(int cleaningRecordId, int staffId) {
        return cleaningRecordMapper.updateRecordById(cleaningRecordId,staffId);
    }

    /**
     * @author treasy
     * @description 根据staffId查清理信息
     * @param staffId
     * @return
     */
    @Override
    public List<CleaningRecord> queryInfoByStaffId(int staffId) {
        return cleaningRecordMapper.queryInfoByStaffId(staffId);
    }

    /**
     * @author treasy
     * @description 根据staffId和状态查清理信息
     * @param staffId
     * @param cleaningState
     * @return
     */
    @Override
    public List<CleaningRecord> queryInfoByStaffIdAndState(int staffId, Integer cleaningState) {
        return cleaningRecordMapper.queryInfoByStaffIdAndState(staffId,cleaningState);
    }

    @Override
    public int updateRecordState(int cleaningRecordId, String cleanOverTime) {
        return cleaningRecordMapper.updateRecordState(cleaningRecordId, cleanOverTime);
    }

    @Override
    public List<CleaningRecord> queryAll() {
        return cleaningRecordMapper.queryAll();
    }

    @Override
    public int insertOne(Integer roomId, String recordTime) {
        return cleaningRecordMapper.insertOne(roomId,recordTime);
    }
}
